<?php
// +----------------------------------------------------------------------
// | 中联致远服务端框架
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://www.zhongliansoft.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: tony <tanyu@zhongliansoft.com>
// +----------------------------------------------------------------------

namespace app\Manage\controller;

use app\common\controller\Manage;
use app\common\model\ViewGetWxUser as ViewGetWxUserModel;
use app\common\model\Common;
use think\facade\Request;
use think\Db;

class Collection extends Manage
{
    // 教材批量发放
    public function WxUserIndex()
    {    
        if(Request::isAjax()){
            $viewGetWxUserModel = new ViewGetWxUserModel();
            return $viewGetWxUserModel->tableData(input('param.'));
        }
         
        return $this->fetch("/wxuser/index");
    }

    /**
     *  冻结微信用户登录
     * User:tony
     * @return array
     */
    public function WxUserDisable()
    {
        $result = [
            'status' => false,
            'msg' => '冻结失败',
            'data' => []
        ];

        $input  = input('param.');
        $model = new Common();
        $model->query("call updateWxUser('".$input['xhs']."','0');");
 
        $result['status'] = true;
        $result['msg'] = '冻结成功';
        
        return $result;
    }

    /**
     *  解除冻结微信用户登录
     * User:tony
     * @return array
     */
    public function WxUserEnable()
    {
        
        $result = [
            'status' => false,
            'msg' => '解除冻结失败',
            'data' => []
        ];

        $input  = input('param.');
        $model = new Common();
        $model->query("call updateWxUser('".$input['xhs']."','1');");
 
        $result['status'] = true;
        $result['msg'] = '解除冻结成功';
        
        return $result;
    }
}